<?php
/**
 * 用户模型
 * @author Yangdong Zhang <zhangyangdong@gouuse.cn>
 * @time 2018/10/12 15:49
 */
namespace App\Model;

class User extends Model
{
    /**
     * 获取用户信息
     * @return array
     * @throws \Exception
     */
    public function getInfo()
    {
        $data = $this->where(['id' => $this->user_id])->field(['nickname', 'email'])->find();
        if ($data) $data = $data->toArray();

        return $data ? $data : [];
    }
}